package jianzhioffer;

// 剑指 Offer 11. 旋转数组的最小数字
public class MinArray {

    public static void main(String[] args) {

    }

    // 和普通的查找最小值的区别是，他有重复元素，得去重
    public int minArray(int[] numbers) {
        int left = 0;
        int right = numbers.length - 1;
        while (left < right) {
            int mid = (left + right) >> 1;
            if (numbers[right] < numbers[mid]) {

                left = mid + 1;
            } else if (numbers[right]>numbers[mid]){
                right = mid;
            }else {
                right--;
            }
        }
        return numbers[left];
    }
}
